﻿#pragma once

#include <chrono>
#include <cstddef>
#include <filesystem>
#include <string>
#include <vector>

namespace asycipc::linux_diagnostics {

struct FifoHealthStats {
  std::size_t total_sessions = 0;
  std::size_t active_sessions = 0;
  std::size_t incomplete_sessions = 0;
  std::size_t stale_sessions = 0;
};

struct FifoSessionDetail {
  std::string session_id;
  std::chrono::seconds age{0};
  bool has_in = false;
  bool has_out = false;
  bool is_stale = false;
  bool is_incomplete = false;
};

FifoHealthStats InspectFifoHealth(const std::filesystem::path& base_dir,
                                  std::chrono::seconds stale_age);

std::vector<FifoSessionDetail> CollectFifoSessions(const std::filesystem::path& base_dir,
                                                   std::chrono::seconds stale_age);

std::size_t CleanupFifoSessions(const std::filesystem::path& base_dir,
                                std::chrono::seconds stale_age);

}  // namespace asycipc::linux_diagnostics
